<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/vendor/bootstrap/css/bootstrap.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Custom Font Icons CSS-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/font.css">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/custom.css">
    <title>会议详情</title>
    <style>

        .myTitle > input{
            float: right;
            margin-left: 15px;
        }

    </style>
</head>
<body>
<header class="header">
    <nav class="navbar navbar-expand-lg">
        <div class="search-panel">
            <div class="search-inner d-flex align-items-center justify-content-center">
                <div class="close-btn">Close <i class="fa fa-close"></i></div>
                <form id="searchForm" action="#">
                    <div class="form-group">
                        <input type="search" name="search" placeholder="What are you searching for...">
                        <button type="submit" class="submit">Search</button>
                    </div>
                </form>
            </div>
        </div>
        <div class="container-fluid d-flex align-items-center justify-content-between">
            <div class="navbar-header">
                <!-- Navbar Header--><a href="${pageContext.request.contextPath}/view/home" class="navbar-brand">
                <div class="brand-text brand-big visible text-uppercase"><strong
                        class="text-primary">小标</strong><strong>交友</strong></div>
                <div class="brand-text brand-sm"><strong class="text-primary">X</strong><strong>B</strong></div>
            </a>
                <!-- Sidebar Toggle Btn-->
                <button class="sidebar-toggle"><i class="fa fa-long-arrow-left"></i></button>
            </div>
            <div class="right-menu list-inline no-margin-bottom">
                <!-- Log out -->
                <div class="list-inline-item logout">
                    <a id="logout" href="${pageContext.request.contextPath}/login/Logout" class="nav-link"><span
                            class="d-none d-sm-inline">Logout </span></a>
                </div>
            </div>
        </div>
    </nav>
</header>

<div class="d-flex align-items-stretch">
    <!-- Sidebar Navigation-->
    <nav id="sidebar">
        <!-- Sidebar Header-->
        <div class="sidebar-header d-flex align-items-center">
            <div id="avatar" class="avatar">
                <c:if test="${sessionScope.userBaseInfo.pic == null}">
                    <img id="myHeadPic" src="${pageContext.request.contextPath}/assets/img/avatar-6.jpg" alt="..." class="img-fluid rounded-circle">
                </c:if>

                <c:if test="${sessionScope.userBaseInfo.pic != null}">
                    <img id="myHeadPic" src="${pageContext.request.contextPath}${sessionScope.userBaseInfo.pic}" alt="..." class="img-fluid rounded-circle">
                </c:if>
            </div>
            <div class="title">
                <h1 class="h5">${sessionScope.userBaseInfo.username}</h1>
                <p>${sessionScope.userBaseInfo.deptName}</p>
            </div>
        </div>
        <!-- Sidebar Navidation Menus--><span class="heading">Main</span>
        <ul class="list-unstyled">
            <li><a href="${pageContext.request.contextPath}/view/home"> <i class="icon-home"></i>主页 </a></li>
            <li><a href="#userDropdown" data-toggle="collapse"> <i
                    class="icon-windows"></i>用户列表</a>
                <ul id="userDropdown" class="collapse list-unstyled ">
                    <li><a href="${pageContext.request.contextPath}/user/list">查看用户</a></li>
                    <li><a href="${pageContext.request.contextPath}/view/myUser">我关注的用户</a></li>
                    <li><a href="${pageContext.request.contextPath}/view/article">发布文章</a></li>
                    <li><a href="${pageContext.request.contextPath}/art/favList">我的收藏</a></li>
                </ul>
            </li>
            <!--<li><a href="login.html"> <i class="icon-logout"></i>Login page </a></li>-->

            <li><a href="#depDropdown" data-toggle="collapse" aria-expanded="true"> <i class="icon-windows2"></i>部门列表</a>
                <ul id="depDropdown" class="collapse show">
                    <li><a href="${pageContext.request.contextPath}/view/department">全部部门</a></li>
                    <li><a href="${pageContext.request.contextPath}/meet/list">会议系统</a></li>
                </ul>
            </li>

        </ul>

    </nav>
    <!-- Sidebar Navigation end-->
    <div class="page-content">
        <div class="page-header">
            <div class="container-fluid">
                <h2 class="h5 no-margin-bottom">会议详情</h2>
            </div>
        </div>

        <section class="no-padding-bottom">

            <div class="myTitle">
                <h3 class="text-center">${requestScope.meet.title}</h3>
                <c:if test="${requestScope.meet.confUId == sessionScope.userBaseInfo.id}">
                    <c:if test="${requestScope.meet.status == 1}">
                        <input type="submit" value="开始会议" class="btn btn-info" id="meetbeg">
                    </c:if>
                    <c:if test="${requestScope.meet.status == 2}">
                        <input type="submit" value="结束会议" class="btn btn-danger" id="meetend">
                    </c:if>
                    <c:if test="${requestScope.meet.status == 0}">
                        <input type="submit" value="结束会议" class="btn btn-danger"  disabled>
                    </c:if>
                </c:if>
                <c:if test="${requestScope.meet.confUId != sessionScope.userBaseInfo.id}">
                    <c:if test="${requestScope.meet.come == 1}">
                        <input type="submit" value="取消会议" class="btn btn-danger" id="delJoin">
                    </c:if>
                    <c:if test="${requestScope.meet.come == 0}">
                        <input type="submit" value="参加会议" class="btn btn-info" id="addJoin">
                    </c:if>
                    <c:if test="${requestScope.meet.come == null}">
                        <input type="submit" value="参加会议" class="btn btn-info" id="addJoin">
                    </c:if>
                </c:if>
            </div>

            <div class="myContent">
                <p class="h6"><strong>部门：</strong>${requestScope.meet.deptName}</p>
                <c:if test="${requestScope.meet.deptId == sessionScope.userBaseInfo.deptId}">
                    <p class="h6"><strong>应到：</strong>${requestScope.meet.utotal - 1}<span>人</span></p>
                    <p class="h6"><strong>实到：</strong>${requestScope.meet.jtotal}<span>人</span></p>
                    <c:if test="${requestScope.meet.utotal - requestScope.meet.jtotal == 0}">
                        <p class="h6"><strong>未到：</strong>${requestScope.meet.utotal - requestScope.meet.jtotal - 1}<span>人</span></p>
                    </c:if>
                    <c:if test="${requestScope.meet.utotal - requestScope.meet.jtotal != 0}">
                        <p class="h6"><strong>未到：</strong>${requestScope.meet.utotal - requestScope.meet.jtotal - 1}<span>人</span></p>
                    </c:if>

                </c:if>
                <c:if test="${requestScope.meet.deptId != sessionScope.userBaseInfo.deptId}">
                    <p class="h6"><strong>应到：</strong>${requestScope.meet.utotal}<span>人</span></p>
                    <p class="h6"><strong>实到：</strong>${requestScope.meet.jtotal}<span>人</span></p>
                    <p class="h6"><strong>未到：</strong>${requestScope.meet.utotal - requestScope.meet.jtotal}<span>人</span></p>
                </c:if>
                <textarea style="padding: 2px" disabled="disabled" class="form-control" rows="11">${requestScope.meet.content}</textarea>


            </div>

            <div class="text-right myList">
                <p>日期：${requestScope.meet.pubDate}</p>
            </div>
        </section>

        <footer class="footer">
            <div class="footer__block block no-margin-bottom">
                <div class="container-fluid text-center">
                    <p class="no-margin-bottom">Copyright &copy; 2019.Company <a href="#" >东方标准</a> </p>
                </div>
            </div>
        </footer>
    </div>
</div>

<!-- JavaScript files-->
<script src="${pageContext.request.contextPath}/assets/vendor/jquery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/popper.js/umd/popper.min.js"> </script>
<script src="${pageContext.request.contextPath}/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/jquery.cookie/jquery.cookie.js"> </script>
<script src="${pageContext.request.contextPath}/assets/vendor/chart.js/Chart.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/vendor/jquery-validation/jquery.validate.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/charts-home.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/front.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/custom.js"></script>
<script>

    $(function () {
        $("#delJoin").click(function () {
            $.ajax({
                url:"${pageContext.request.contextPath}/meet/delJoin?cId=${requestScope.meet.id}",
                data:{},
                dataType:"json",
                success:function (result) {
                    if (result == null){
                        window.location.href = '${pageContext.request.contextPath}/view/meetDetail?meetId=${requestScope.meet.id}';
                    }
                }
            })
        });
        $("#addJoin").click(function () {
            $.ajax({
                url:"${pageContext.request.contextPath}/meet/addJoin?cId=${requestScope.meet.id}",
                data:{},
                dataType:"json",
                success:function (result) {
                    if (result == null){
                        window.location.href = '${pageContext.request.contextPath}/view/meetDetail?meetId=${requestScope.meet.id}';
                    }
                }
            })
        });
        $("#meetend").click(function () {
            $.ajax({
                url:"${pageContext.request.contextPath}/meet/meetEnd?cId=${requestScope.meet.id}",
                data:{},
                dataType:"json",
                success:function (result) {
                    if (result == null){
                        window.location.href = '${pageContext.request.contextPath}/view/meetDetail?meetId=${requestScope.meet.id}';
                    }
                }
            })
        });
        $("#meetbeg").click(function () {
            $.ajax({
                url:"${pageContext.request.contextPath}/meet/meetBeg?cId=${requestScope.meet.id}",
                data:{},
                dataType:"json",
                success:function (result) {
                    if (result == null){
                        window.location.href = '${pageContext.request.contextPath}/view/meetDetail?meetId=${requestScope.meet.id}';
                    }
                }
            })
        });
    })

</script>
</body>
</html>